import java.util.Scanner;
//汽水瓶
public class test {
    import java.util.*;
    public class Main{
        public static void main(String[]args){
            Scanner sc=new Scanner(System.in);
            while(sc.hasNext()){
                int num=sc.nextInt();
                if(getNum(num)!=0){
                    System.out.println(getNum(num));
                }
            }
        }
        public static int getNum(int num){//num为空瓶的个数
            //汽水的个数
            int sum=0;
            while(num>1){
                //兑换的汽水的个数num/3
                sum+=num/3;
                //剩余的空瓶子
                num=num/3+num%3;
                if(num==2){
                    //借一瓶
                    sum++;
                    break;
                }
            }
            return sum;
        }
    }
}
